package util;

public class TimeUtil {
	public interface Task {
		void execute();
	}
	
	public static void elapsed(String title, Task task) {
		if (task == null) return;
		if (title == null) title = "";
		long start = System.currentTimeMillis();
		task.execute();
		long end = System.currentTimeMillis();
		double elapsed = (end - start) / 1000.0;
		System.out.printf("[%s]，耗时：%.2f秒", title, elapsed);
	}
}
